﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace 火星文
{
    class MyDictionary
    {
        private List<MyKeyValue> list = new List<MyKeyValue>();


        public void Add(char key, char value)
        {
            if (ContainsKey(key))
            {
                throw new Exception();
            }
            list.Add(new MyKeyValue() { Key=key,Value=value});
        }

        public bool ContainsKey(char key)
        {
            foreach (MyKeyValue kv in list)
            {
                if (kv.Key == key)
                {
                    return true;
                }
            }
            return false;
        }

        public char this[char key]
        {
            get
            {
                foreach (MyKeyValue kv in list)
                {
                    if (kv.Key == key)
                    {
                        return kv.Value;
                    }
                }
                throw new Exception();
            }
        }
    }

    class MyKeyValue
    {
        public char Key { get; set; }
        public char Value { get; set; }
    }
}
